catch contents generated during run by subprocess in Python